<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<title>SMART VE</title>
<link rel="stylesheet" href="css/jquery.mobile-1.3.0.css" />
<link rel="stylesheet" href="css/main.css" />
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.3.0.min.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript">
function join(){
	var VE_MEMBER_ID = $("#VE_MEMBER_ID").val();
	var USERNAME = $("#USERNAME").val();
	var PW = $("#PW").val();
	
	if(VE_MEMBER_ID==""){
		alert("E-mail을 입력해 주세요.");
		return;
	}
	else if(USERNAME == ""){
		alert("이름을 입력해 주세요.");
		return;
	}
	else if(PW == ""){
		alert("비밀번호를 입력해 주세요.");
		return;
	}
	
	var url = "member.do";
	$.getJSON(url, "action=join&VE_MEMBER_ID="+VE_MEMBER_ID+"&USERNAME="+USERNAME+"&PW="+PW, function(json){
		if(json>0){
			alert('회원가입을 완료하였습니다. 로그인 해주세요!');
		}else if(json < 0){
			alert('이미 가입된 메일 주소입니다.다시 회원가입을 해주세요!');
		}else{
			alert('회원 가입에 실패하였습니다. 다시 회원가입을 해주세요!');
		}
		location.href = "/smartve";
	});
}
</script>
</head>
<body class="main">
<div id="wrapper" data-role="page">
	<div id="header" data-role="header" data-position="fixed" data-tap-toggle="false">
<!-- 2013-05-14 back버튼 수정 -->
		<a href="javascript:history.back(-1);" class="btn_back">back</a>
		<h1>New Account</h1>
	</div>
	<div id="container" data-role="content" class="pnl_content">
		<div id="new_account" class="content">
			<ul class="field">
				<li><input type="email" id="VE_MEMBER_ID" name="VE_MEMBER_ID" placeholder="E-mail" data-role="none" class="textform" /></li>
				<li><input type="text" id="USERNAME" name="USERNAME" placeholder="Username" data-role="none" class="textform" /></li>
				<li><input type="password" id="PW" name="PW" placeholder="Password" data-role="none" class="textform" /></li>
			</ul>
			<a href="#" onclick ="join();" class="btn_green_wide">가입하기</a>
			<p>계정등록을 통해 본인은 SMART VE 의 <br /><a href="member.do?action=agreement">이용약관 및 개인정보보호</a> 방침에 동의합니다</p>
		</div>
	</div>
</div>
</body>
</html>